<template>
  <div class="hotGoods">
    <p>热卖商品</p>
    <ul class="goods">
      <li v-for="item of hotGoods" :key="item.goodsId">
        <!-- <router-link :to="{name:'detail',params:{id:item.goodsId}}"> -->
        <img v-lazy="item.image" @click="showGoods(item.goodsId)">
        <p>{{item.name}}</p>
        <p>{{item.price | rmb}}</p>
        <!-- </router-link> -->
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ["hotGoods"],
  filters: {
    rmb(value) {
      return "￥" + value;
    }
  },
  methods: {
    showGoods(id) {
      // console.log(this)
      this.$parent.$parent.getDetail(id);
    }
  }
};
</script>

<style lang="scss" scoped>
.hotGoods {
  & > p {
    height: 35px;
    font-size: 14px;
    line-height: 35px;
    text-align: center;
  }
  .goods {
    width: 100%;
    text-align: center;
    li {
      width: 187.5px;
      float: left;
      background-color: white;
      img {
        width: 100%;
      }
      p {
        line-height: 30px;
      }
      p:nth-of-type(1) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}
</style>